<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>人事信息管理系统</title>
<link rel="stylesheet" href="resources/bootstrap.min.css">  
<script src="resources/jquery.min.js"></script>
<script src="resources/bootstrap.min.js"></script>
<script src="resources/layer/layer.js"></script>
</head>
<body>
	<div class="jumbotron text-center" style="margin-bottom:0">
		<h3>部门信息录入</h3>
		<form method="post" action="addData">
			<table class="table table-bordered">
	        <caption>•部门信息管理——部门信息录入（以下带<span style="color: red">*</span>为必填项）</caption>
		        <tr>
		            <td>部门ID号：<input type="text" name="id" size="45" /><span style="color: red">*</span></td>
		        </tr>
		         <tr>
		            <td>部门名称：<input type="text" name="name" size="45" /><span style="color: red">*</span></td>
		        </tr>
		         <tr>
		            <td>部门类型：<input type="text" name="type" size="45" /><span style="color: red">*</span></td>
		        </tr>
		         <tr>
		            <td>部门电话：<input type="text" name="telephone" size="45" /><span style="color: red">*</span></td>
		        </tr>
		         <tr>
		            <td>部门传真：<input type="text" name="fax" size="45" /></td>
		        </tr>
		         <tr>
		            <td>部门描述：<input type="text" name="description" size="45" /></td>
		        </tr>
		         <tr>
		            <td>上级部门：<input type="text" name="predepartment" size="45" /></td>
		        </tr>
		         <tr>
		            <td>成立日期：<input type="text" name="date" size="45" /><span style="color: red">*</span></td>
		        </tr>
		     </table>
			<button type="button" class="btn btn-success text-center" onclick="submitAdd();">确定</button>
​		</form>
	</div>
</body>
</html>
<script type="text/javascript">
function submitAdd(){
	// 非空判断
	if($('[name="id"]').val() == ''){ layer.alert("部门ID必须填写")}
	else if($('[name="name"]').val() == ''){ layer.alert("部门名称必须填写")}
	else if($('[name="type"]').val() == ''){ layer.alert("部门类型必须填写")}
	else if($('[name="telephone"]').val() == ''){ layer.alert("部门电话必须填写")}
	else if($('[name="date"]').val() == ''){ layer.alert("成立日期必须填写")}
	else {$("form").submit();}
}
</script>